﻿using Jerry.DroidBuilder.ThemeEditor;
using System.IO;

namespace Jerry.DroidBuilder
{
    public class ThemeEditorViewModel : ViewModelBase
    {
        private string _layoutXml;
        private LayoutInfo _layoutInfo;

        public ThemeEditorViewModel(string fileName)
            : base(false, false, false)
        {
            LayoutXml = File.ReadAllText(fileName);
            //LayoutInfo = LayoutLoader.LoadXml(layoutXml);
        }

        public string LayoutXml
        {
            get { return _layoutXml; }
            set
            {
                _layoutXml = value;
                OnPropertyChanged(() => LayoutXml);

                LayoutInfo = LayoutLoader.LoadXml(value);
            }
        }

        public LayoutInfo LayoutInfo
        {
            get { return _layoutInfo; }
            private set
            {
                _layoutInfo = value;
                OnPropertyChanged(() => LayoutInfo);
            }
        }
    }
}
